package com.yiqi.liebang.feature.setting.view.adapter;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.utils.logger.Logger;
import com.yiqi.liebang.R;
import com.yiqi.liebang.entity.bo.SelectBo;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;

public class BlackAdapter extends BaseQuickAdapter<SelectBo, BaseViewHolder> {

    public static HashMap<Integer, Boolean> isSelected;
    List<SelectBo> mData;
    CompoundButton.OnCheckedChangeListener listener;

    private boolean isCheckALL = false;
    private int selected = 0;

    public BlackAdapter(List<SelectBo> baseBos) {
        super(R.layout.item_private_black, baseBos);
        mData = baseBos;
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectBo item) {
        helper.setText(R.id.tv_user_money, item.getText() + "")
                .setOnCheckedChangeListener(R.id.tv_user_money, listener)
                .setTag(R.id.tv_user_money, item)
                .setChecked(R.id.tv_user_money, selected == helper.getAdapterPosition()?true:false)
        ;


    }

    public void setCheckAll(boolean isCheckALL) {
        this.isCheckALL = isCheckALL;
        notifyDataSetChanged();
    }

    public void setSelection(int position) {
        this.selected = position;
        notifyDataSetChanged();
    }
    public void setOnCheckedChangeListener( CompoundButton.OnCheckedChangeListener listener) {
        this.listener = listener;
    }

}